cmake_minimum_required(VERSION 3.10)

message("proj_src_dirs:${PROJECT_SOURCE_DIR}")

include_directories(${PROJECT_SOURCE_DIR}/src)

add_library(expvec_avx OBJECT
  myexp_vec_avx.c
)
target_compile_options(expvec_avx PUBLIC -mavx)

add_library(expvec_avx2 OBJECT
  myexp_vec_avx2.c
)
target_compile_options(expvec_avx2 PUBLIC -mavx2 -mfma)

add_library(myexp STATIC
  exp_data_52.c
  exp_data_61.c
  exp_data_64.c
  myexp_v1.c
  myexp_v2.c
  myexp_v3.c
  $<TARGET_OBJECTS:expvec_avx>
  $<TARGET_OBJECTS:expvec_avx2>
)

add_custom_target( # For check asm code
  myexp_vec_avx_asm
  ALL
  COMMAND gcc -S -masm=intel -mavx -O1 ${CMAKE_CURRENT_SOURCE_DIR}/myexp_vec_avx.c
    -o ${PROJECT_BINARY_DIR}/myexp_vec_avx.asm
)

add_custom_target( # For check asm code
  myexp_vec_avx2_asm
  ALL
  COMMAND gcc -S -masm=intel -mavx2 -mfma -O1 ${CMAKE_CURRENT_SOURCE_DIR}/myexp_vec_avx2.c
    -o ${PROJECT_BINARY_DIR}/myexp_vec_avx2.asm
)



